package com.sx.zongzhi.presenter;

import com.sx.zongzhi.MyApplication;
import com.sx.zongzhi.bean.OverseasDetailBean;
import com.sx.zongzhi.modle.CollectManager;
import com.sx.zongzhi.net.BaseCallBack;
import com.sx.zongzhi.net.BaseResult;
import com.sx.zongzhi.view.IOverseasDetailView;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by XZY on 2017/11/30.
 *获取境外人员列表
 */
public class OverseasDetailPest {

    private IOverseasDetailView detailView;

    public OverseasDetailPest(IOverseasDetailView detailView) {
        this.detailView=detailView;
    }



    /**
     *
     * @param id 境外人员id
     */
    public void getOverseasDetail(String id){
        Map<String,Object> map=new HashMap<>();
        map.put("sid", MyApplication.sid);
        map.put("id", id);
        new CollectManager().getOverseasDetail(map, new BaseCallBack<BaseResult<OverseasDetailBean>>() {
            @Override
            public void onSuccess(BaseResult<OverseasDetailBean> response) {
                detailView.getOverSeasDetail(response.getData());
            }
            @Override
            public void onFailures(String message) {
                detailView.showError(message);
            }
        });
    }

    /**
     *
     * @param id 境外人员id
     */
    public void deleteOverseas(String id){
        Map<String,Object> map=new HashMap<>();
        map.put("sid", MyApplication.sid);
        map.put("id", id);

        new CollectManager().deleteOverseas(map, new BaseCallBack<BaseResult<Boolean>>() {
            @Override
            public void onSuccess(BaseResult<Boolean> response) {
                detailView.deleteOverseas(response.getData());
            }
            @Override
            public void onFailures(String message) {
                detailView.showError(message);
            }
        });
    }


}
